<script>
  /*
   * @Author: Zhang Yingying
   * @Date: 2020-10-24 17:37:30
   * @LastEditors: Zhang Yingying
   * @LastEditTime: 2020-11-07 13:20:04
   */

  import Component from 'vue-class-component'
  import { Prop } from 'vue-property-decorator'
  import BaseControl from './base-control.vue'

  @Component({
    name: 'RadioGroup',
  })
  export default class RadioGroup extends BaseControl {
    render(h) {
      var { style, ...rest } = this.$attrs
      return (
        <el-radio-group
          {...{
            props: {
              ...rest,
              value: this.value,
            },
            attrs: {
              ...rest,
            },
            on: {
              ...this.$listeners,
              input: (val) => {
                this.$emit('input', val)
              },
            },
          }}
        >
          {rest.options.map((item) => {
            return <el-radio label={item.value}>{item.label}</el-radio>
          })}
        </el-radio-group>
      )
    }
  }
</script>
